layui.use(['view', 'jquery'], function () {
    var view = layui.view
        , $ = layui.jquery
        , config = {}
        , events = {
            profile: function (othis, setter, view) {
                var url = othis.attr('data-url');
                if (!url) {
                    layer.alert('请先配置请求地址');
                    return false
                }

                var label = othis.attr('data-label')
                var winConfig = {title: label, content: url, area: ['600px', '450px']};
                view.openIframe(winConfig)
            },
            setting: function (othis, setter, view) {
                var company = othis.attr('data-company')
                var content = "<table class=\"layui-table\" lay-skin=\"nob\"> " +
                    "<tr><td style='text-align: center'>版本：YakAdmin V1.0 <i>MIT license</i></td></tr>" +
                    "<tr><td style='text-align: center'>CopyRight © 2020 " + company + " All Rights Reserved.</td></tr>" +
                    "</table>"
                var winConfig = {title: "<i class=\"layui-icon\">&#xe60b;</i> 关于", content: content, area: ['500px', '150px'], maxmin: false};
                view.openPage(winConfig)
            },
            'switch-search': function (othis, setter, view) {
                var $ = layui.jquery
                if (othis.hasClass("layui-icon-up")) {
                    $('.yak-form-search').hide('normal')
                    othis.removeClass('layui-icon-up')
                    othis.addClass('layui-icon-down')
                    return
                }

                if (othis.hasClass("layui-icon-down")) {
                    $('.yak-form-search').show('normal')
                    othis.removeClass('layui-icon-down')
                    othis.addClass('layui-icon-up')
                    return
                }

            }

    }
    events = $.extend(events, YAK_EVENTS || {})
    view.render(config, events)
})